﻿using UnityEngine;


namespace BackpackSystem
{
    /// <summary>
    /// 基类|物品
    /// </summary>
    public class ItemBase
    {
        /// <summary>
        /// 文本 | 名称
        /// </summary>
        public virtual string Name { get; protected set; } = "未命名";

        /// <summary>
        /// 文本 | 描述项
        /// </summary>
        public virtual string Description { get; protected set; } = "暂无描述项";

        /// <summary>
        /// 枚举 | 物品类型
        /// </summary>
        public virtual ItemType ItemType { get; protected set; } = ItemType.None;




        /// <summary>
        /// 精灵 | 图标项
        /// </summary>
        public virtual Sprite Icon { get; protected set; }

        /// <summary>
        /// 游戏对象 | 预制体
        /// </summary>
        public virtual GameObject Prefab { get; protected set; }






        public virtual ItemBase InitItem()
        { 
            this.Icon = ItemLoader.Load<Sprite>(Name);
            this.Prefab = ItemLoader.Load<GameObject>(Name);

            return this;
        }





        public static ItemBase Default()
        {
            return new ItemBase();
        }
    }
}
